﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;

namespace 字符串和正则表达式
{
    class Program
    {
        static void Main(string[] args)
        {
            string message1 = "hello world";
            message1 += "heee";
            Console.WriteLine(message1);
            Console.WriteLine("hello wwold");
           
            char q = message1[2];
            Console.WriteLine(q);
            //#################
            //Compare 比较字符串的内容111222
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("DDD");

            Console.WriteLine(stringBuilder.Length);
            Console.WriteLine(stringBuilder.Capacity);
            Console.WriteLine(stringBuilder.MaxCapacity);
            string X = stringBuilder.ToString();
            
            stringBuilder.AppendFormat("DDDD");
            Console.WriteLine(stringBuilder);
            RNGCryptoServiceProvider csp=new RNGCryptoServiceProvider();
            byte[] byteCsp = new byte[4];
            csp.GetBytes(byteCsp);
            string a = BitConverter.ToString(byteCsp);
            a = a.Replace("-","");

            Console.WriteLine(a);

            //正则表达式
            const string pattern = "ion";
            MatchCollection myMatches = Regex.Matches("myion sion", pattern, RegexOptions.IgnoreCase);
            foreach (var item in myMatches)
            {
                Console.WriteLine(item);

            }
            //集合
            var list = new List<string>();
            list.Add("hello world");
            Console.WriteLine(list.Capacity);
            Console.WriteLine(list.Count);
            //hashtable 是Dictionary的实现子类
            Hashtable ht = new Hashtable();
            //字典
            Dictionary<string, string> dic = new Dictionary<string, string>();
           
        }
    }
}
